<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "auditoriasinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$auditorias_delete = NULL; // Initialize page object first

class cauditorias_delete extends cauditorias {

	// Page ID
	var $PageID = 'delete';

	// Project ID
	var $ProjectID = "{0077F69D-1CA4-4B45-8DC5-8692146F4B48}";

	// Table name
	var $TableName = 'auditorias';

	// Page object name
	var $PageObjName = 'auditorias_delete';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (auditorias)
		if (!isset($GLOBALS["auditorias"]) || get_class($GLOBALS["auditorias"]) == "cauditorias") {
			$GLOBALS["auditorias"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["auditorias"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'delete', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'auditorias', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->ProjectID . $this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanDelete()) {
			$Security->SaveLastUrl();
			$this->setFailureMessage($Language->Phrase("NoPermission")); // Set no permission
			$this->Page_Terminate("auditoriaslist.php");
		}
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->Auditoria->Visible = !$this->IsAdd() && !$this->IsCopy() && !$this->IsGridAdd();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $TotalRecs = 0;
	var $RecCnt;
	var $RecKeys = array();
	var $Recordset;
	var $StartRowCnt = 1;
	var $RowCnt = 0;

	//
	// Page main
	//
	function Page_Main() {
		global $Language;

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Load key parameters
		$this->RecKeys = $this->GetRecordKeys(); // Load record keys
		$sFilter = $this->GetKeyFilter();
		if ($sFilter == "")
			$this->Page_Terminate("auditoriaslist.php"); // Prevent SQL injection, return to list

		// Set up filter (SQL WHHERE clause) and get return SQL
		// SQL constructor in auditorias class, auditoriasinfo.php

		$this->CurrentFilter = $sFilter;

		// Get action
		if (@$_POST["a_delete"] <> "") {
			$this->CurrentAction = $_POST["a_delete"];
		} else {
			$this->CurrentAction = "I"; // Display record
		}
		switch ($this->CurrentAction) {
			case "D": // Delete
				$this->SendEmail = TRUE; // Send email on delete success
				if ($this->DeleteRows()) { // Delete rows
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("DeleteSuccess")); // Set up success message
					$this->Page_Terminate($this->getReturnUrl()); // Return to caller
				}
		}
	}

// No functions
	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn;

		// Call Recordset Selecting event
		$this->Recordset_Selecting($this->CurrentFilter);

		// Load List page SQL
		$sSql = $this->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $rowcnt OFFSET $offset";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$this->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->Auditoria->setDbValue($rs->fields('Auditoria'));
		$this->AuditoriaFecha->setDbValue($rs->fields('AuditoriaFecha'));
		$this->AuditoriaTipo->setDbValue($rs->fields('AuditoriaTipo'));
		$this->AuditoriaSucursal->setDbValue($rs->fields('AuditoriaSucursal'));
		$this->AuditoriaCreo->setDbValue($rs->fields('AuditoriaCreo'));
		$this->AuditoriaResponsable->setDbValue($rs->fields('AuditoriaResponsable'));
		$this->AuditoriaFechaVisita->setDbValue($rs->fields('AuditoriaFechaVisita'));
		$this->AuditoriaResultado->setDbValue($rs->fields('AuditoriaResultado'));
		$this->AuditoriaObservacion->setDbValue($rs->fields('AuditoriaObservacion'));
		$this->AuditoriaPublicar->setDbValue($rs->fields('AuditoriaPublicar'));
		$this->AuditoriaEstado->setDbValue($rs->fields('AuditoriaEstado'));
		$this->AuditoriaDescargo->setDbValue($rs->fields('AuditoriaDescargo'));
		$this->AuditoriaFechaCierre->setDbValue($rs->fields('AuditoriaFechaCierre'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->Auditoria->DbValue = $row['Auditoria'];
		$this->AuditoriaFecha->DbValue = $row['AuditoriaFecha'];
		$this->AuditoriaTipo->DbValue = $row['AuditoriaTipo'];
		$this->AuditoriaSucursal->DbValue = $row['AuditoriaSucursal'];
		$this->AuditoriaCreo->DbValue = $row['AuditoriaCreo'];
		$this->AuditoriaResponsable->DbValue = $row['AuditoriaResponsable'];
		$this->AuditoriaFechaVisita->DbValue = $row['AuditoriaFechaVisita'];
		$this->AuditoriaResultado->DbValue = $row['AuditoriaResultado'];
		$this->AuditoriaObservacion->DbValue = $row['AuditoriaObservacion'];
		$this->AuditoriaPublicar->DbValue = $row['AuditoriaPublicar'];
		$this->AuditoriaEstado->DbValue = $row['AuditoriaEstado'];
		$this->AuditoriaDescargo->DbValue = $row['AuditoriaDescargo'];
		$this->AuditoriaFechaCierre->DbValue = $row['AuditoriaFechaCierre'];
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// Auditoria
		// AuditoriaFecha
		// AuditoriaTipo
		// AuditoriaSucursal
		// AuditoriaCreo
		// AuditoriaResponsable
		// AuditoriaFechaVisita
		// AuditoriaResultado
		// AuditoriaObservacion
		// AuditoriaPublicar
		// AuditoriaEstado
		// AuditoriaDescargo
		// AuditoriaFechaCierre

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// Auditoria
			$this->Auditoria->ViewValue = $this->Auditoria->CurrentValue;
			$this->Auditoria->ViewCustomAttributes = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->ViewValue = $this->AuditoriaFecha->CurrentValue;
			$this->AuditoriaFecha->ViewValue = ew_FormatDateTime($this->AuditoriaFecha->ViewValue, 7);
			$this->AuditoriaFecha->ViewCustomAttributes = "";

			// AuditoriaTipo
			$this->AuditoriaTipo->ViewValue = $this->AuditoriaTipo->CurrentValue;
			$this->AuditoriaTipo->ViewCustomAttributes = "";

			// AuditoriaSucursal
			$this->AuditoriaSucursal->ViewValue = $this->AuditoriaSucursal->CurrentValue;
			$this->AuditoriaSucursal->ViewCustomAttributes = "";

			// AuditoriaCreo
			$this->AuditoriaCreo->ViewValue = $this->AuditoriaCreo->CurrentValue;
			$this->AuditoriaCreo->ViewCustomAttributes = "";

			// AuditoriaResponsable
			$this->AuditoriaResponsable->ViewValue = $this->AuditoriaResponsable->CurrentValue;
			$this->AuditoriaResponsable->ViewCustomAttributes = "";

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->ViewValue = $this->AuditoriaFechaVisita->CurrentValue;
			$this->AuditoriaFechaVisita->ViewValue = ew_FormatDateTime($this->AuditoriaFechaVisita->ViewValue, 7);
			$this->AuditoriaFechaVisita->ViewCustomAttributes = "";

			// AuditoriaResultado
			$this->AuditoriaResultado->ViewValue = $this->AuditoriaResultado->CurrentValue;
			$this->AuditoriaResultado->ViewCustomAttributes = "";

			// AuditoriaObservacion
			$this->AuditoriaObservacion->ViewValue = $this->AuditoriaObservacion->CurrentValue;
			$this->AuditoriaObservacion->ViewCustomAttributes = "";

			// AuditoriaPublicar
			$this->AuditoriaPublicar->ViewValue = $this->AuditoriaPublicar->CurrentValue;
			$this->AuditoriaPublicar->ViewCustomAttributes = "";

			// AuditoriaEstado
			$this->AuditoriaEstado->ViewValue = $this->AuditoriaEstado->CurrentValue;
			$this->AuditoriaEstado->ViewCustomAttributes = "";

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->ViewValue = $this->AuditoriaFechaCierre->CurrentValue;
			$this->AuditoriaFechaCierre->ViewValue = ew_FormatDateTime($this->AuditoriaFechaCierre->ViewValue, 7);
			$this->AuditoriaFechaCierre->ViewCustomAttributes = "";

			// Auditoria
			$this->Auditoria->LinkCustomAttributes = "";
			$this->Auditoria->HrefValue = "";
			$this->Auditoria->TooltipValue = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->LinkCustomAttributes = "";
			$this->AuditoriaFecha->HrefValue = "";
			$this->AuditoriaFecha->TooltipValue = "";

			// AuditoriaTipo
			$this->AuditoriaTipo->LinkCustomAttributes = "";
			$this->AuditoriaTipo->HrefValue = "";
			$this->AuditoriaTipo->TooltipValue = "";

			// AuditoriaSucursal
			$this->AuditoriaSucursal->LinkCustomAttributes = "";
			$this->AuditoriaSucursal->HrefValue = "";
			$this->AuditoriaSucursal->TooltipValue = "";

			// AuditoriaCreo
			$this->AuditoriaCreo->LinkCustomAttributes = "";
			$this->AuditoriaCreo->HrefValue = "";
			$this->AuditoriaCreo->TooltipValue = "";

			// AuditoriaResponsable
			$this->AuditoriaResponsable->LinkCustomAttributes = "";
			$this->AuditoriaResponsable->HrefValue = "";
			$this->AuditoriaResponsable->TooltipValue = "";

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->LinkCustomAttributes = "";
			$this->AuditoriaFechaVisita->HrefValue = "";
			$this->AuditoriaFechaVisita->TooltipValue = "";

			// AuditoriaResultado
			$this->AuditoriaResultado->LinkCustomAttributes = "";
			$this->AuditoriaResultado->HrefValue = "";
			$this->AuditoriaResultado->TooltipValue = "";

			// AuditoriaObservacion
			$this->AuditoriaObservacion->LinkCustomAttributes = "";
			$this->AuditoriaObservacion->HrefValue = "";
			$this->AuditoriaObservacion->TooltipValue = "";

			// AuditoriaPublicar
			$this->AuditoriaPublicar->LinkCustomAttributes = "";
			$this->AuditoriaPublicar->HrefValue = "";
			$this->AuditoriaPublicar->TooltipValue = "";

			// AuditoriaEstado
			$this->AuditoriaEstado->LinkCustomAttributes = "";
			$this->AuditoriaEstado->HrefValue = "";
			$this->AuditoriaEstado->TooltipValue = "";

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->LinkCustomAttributes = "";
			$this->AuditoriaFechaCierre->HrefValue = "";
			$this->AuditoriaFechaCierre->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	//
	// Delete records based on current filter
	//
	function DeleteRows() {
		global $conn, $Language, $Security;
		if (!$Security->CanDelete()) {
			$this->setFailureMessage($Language->Phrase("NoDeletePermission")); // No delete permission
			return FALSE;
		}
		$DeleteRows = TRUE;
		$sSql = $this->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE) {
			return FALSE;
		} elseif ($rs->EOF) {
			$this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
			$rs->Close();
			return FALSE;

		//} else {
		//	$this->LoadRowValues($rs); // Load row values

		}
		$conn->BeginTrans();

		// Clone old rows
		$rsold = ($rs) ? $rs->GetRows() : array();
		if ($rs)
			$rs->Close();

		// Call row deleting event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$DeleteRows = $this->Row_Deleting($row);
				if (!$DeleteRows) break;
			}
		}
		if ($DeleteRows) {
			$sKey = "";
			foreach ($rsold as $row) {
				$sThisKey = "";
				if ($sThisKey <> "") $sThisKey .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"];
				$sThisKey .= $row['Auditoria'];
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$DeleteRows = $this->Delete($row); // Delete
				$conn->raiseErrorFn = '';
				if ($DeleteRows === FALSE)
					break;
				if ($sKey <> "") $sKey .= ", ";
				$sKey .= $sThisKey;
			}
		} else {

			// Set up error message
			if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

				// Use the message, do nothing
			} elseif ($this->CancelMessage <> "") {
				$this->setFailureMessage($this->CancelMessage);
				$this->CancelMessage = "";
			} else {
				$this->setFailureMessage($Language->Phrase("DeleteCancelled"));
			}
		}
		if ($DeleteRows) {
			$conn->CommitTrans(); // Commit the changes
		} else {
			$conn->RollbackTrans(); // Rollback changes
		}

		// Call Row Deleted event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$this->Row_Deleted($row);
			}
		}
		return $DeleteRows;
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "auditoriaslist.php", $this->TableVar, TRUE);
		$PageId = "delete";
		$Breadcrumb->Add("delete", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($auditorias_delete)) $auditorias_delete = new cauditorias_delete();

// Page init
$auditorias_delete->Page_Init();

// Page main
$auditorias_delete->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$auditorias_delete->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var auditorias_delete = new ew_Page("auditorias_delete");
auditorias_delete.PageID = "delete"; // Page ID
var EW_PAGE_ID = auditorias_delete.PageID; // For backward compatibility

// Form object
var fauditoriasdelete = new ew_Form("fauditoriasdelete");

// Form_CustomValidate event
fauditoriasdelete.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fauditoriasdelete.ValidateRequired = true;
<?php } else { ?>
fauditoriasdelete.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
// Form object for search

</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php

// Load records for display
if ($auditorias_delete->Recordset = $auditorias_delete->LoadRecordset())
	$auditorias_deleteTotalRecs = $auditorias_delete->Recordset->RecordCount(); // Get record count
if ($auditorias_deleteTotalRecs <= 0) { // No record found, exit
	if ($auditorias_delete->Recordset)
		$auditorias_delete->Recordset->Close();
	$auditorias_delete->Page_Terminate("auditoriaslist.php"); // Return to list
}
?>
<?php $Breadcrumb->Render(); ?>
<?php $auditorias_delete->ShowPageHeader(); ?>
<?php
$auditorias_delete->ShowMessage();
?>
<form name="fauditoriasdelete" id="fauditoriasdelete" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="auditorias">
<input type="hidden" name="a_delete" id="a_delete" value="D">
<?php foreach ($auditorias_delete->RecKeys as $key) { ?>
<?php $keyvalue = is_array($key) ? implode($EW_COMPOSITE_KEY_SEPARATOR, $key) : $key; ?>
<input type="hidden" name="key_m[]" value="<?php echo ew_HtmlEncode($keyvalue) ?>">
<?php } ?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table id="tbl_auditoriasdelete" class="ewTable ewTableSeparate">
<?php echo $auditorias->TableCustomInnerHtml ?>
	<thead>
	<tr class="ewTableHeader">
<?php if ($auditorias->Auditoria->Visible) { // Auditoria ?>
		<td><span id="elh_auditorias_Auditoria" class="auditorias_Auditoria"><?php echo $auditorias->Auditoria->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaFecha->Visible) { // AuditoriaFecha ?>
		<td><span id="elh_auditorias_AuditoriaFecha" class="auditorias_AuditoriaFecha"><?php echo $auditorias->AuditoriaFecha->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaTipo->Visible) { // AuditoriaTipo ?>
		<td><span id="elh_auditorias_AuditoriaTipo" class="auditorias_AuditoriaTipo"><?php echo $auditorias->AuditoriaTipo->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaSucursal->Visible) { // AuditoriaSucursal ?>
		<td><span id="elh_auditorias_AuditoriaSucursal" class="auditorias_AuditoriaSucursal"><?php echo $auditorias->AuditoriaSucursal->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaCreo->Visible) { // AuditoriaCreo ?>
		<td><span id="elh_auditorias_AuditoriaCreo" class="auditorias_AuditoriaCreo"><?php echo $auditorias->AuditoriaCreo->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaResponsable->Visible) { // AuditoriaResponsable ?>
		<td><span id="elh_auditorias_AuditoriaResponsable" class="auditorias_AuditoriaResponsable"><?php echo $auditorias->AuditoriaResponsable->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaVisita->Visible) { // AuditoriaFechaVisita ?>
		<td><span id="elh_auditorias_AuditoriaFechaVisita" class="auditorias_AuditoriaFechaVisita"><?php echo $auditorias->AuditoriaFechaVisita->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaResultado->Visible) { // AuditoriaResultado ?>
		<td><span id="elh_auditorias_AuditoriaResultado" class="auditorias_AuditoriaResultado"><?php echo $auditorias->AuditoriaResultado->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaObservacion->Visible) { // AuditoriaObservacion ?>
		<td><span id="elh_auditorias_AuditoriaObservacion" class="auditorias_AuditoriaObservacion"><?php echo $auditorias->AuditoriaObservacion->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaPublicar->Visible) { // AuditoriaPublicar ?>
		<td><span id="elh_auditorias_AuditoriaPublicar" class="auditorias_AuditoriaPublicar"><?php echo $auditorias->AuditoriaPublicar->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaEstado->Visible) { // AuditoriaEstado ?>
		<td><span id="elh_auditorias_AuditoriaEstado" class="auditorias_AuditoriaEstado"><?php echo $auditorias->AuditoriaEstado->FldCaption() ?></span></td>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaCierre->Visible) { // AuditoriaFechaCierre ?>
		<td><span id="elh_auditorias_AuditoriaFechaCierre" class="auditorias_AuditoriaFechaCierre"><?php echo $auditorias->AuditoriaFechaCierre->FldCaption() ?></span></td>
<?php } ?>
	</tr>
	</thead>
	<tbody>
<?php
$auditorias_delete->RecCnt = 0;
$i = 0;
while (!$auditorias_delete->Recordset->EOF) {
	$auditorias_delete->RecCnt++;
	$auditorias_delete->RowCnt++;

	// Set row properties
	$auditorias->ResetAttrs();
	$auditorias->RowType = EW_ROWTYPE_VIEW; // View

	// Get the field contents
	$auditorias_delete->LoadRowValues($auditorias_delete->Recordset);

	// Render row
	$auditorias_delete->RenderRow();
?>
	<tr<?php echo $auditorias->RowAttributes() ?>>
<?php if ($auditorias->Auditoria->Visible) { // Auditoria ?>
		<td<?php echo $auditorias->Auditoria->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_Auditoria" class="control-group auditorias_Auditoria">
<span<?php echo $auditorias->Auditoria->ViewAttributes() ?>>
<?php echo $auditorias->Auditoria->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaFecha->Visible) { // AuditoriaFecha ?>
		<td<?php echo $auditorias->AuditoriaFecha->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaFecha" class="control-group auditorias_AuditoriaFecha">
<span<?php echo $auditorias->AuditoriaFecha->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaFecha->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaTipo->Visible) { // AuditoriaTipo ?>
		<td<?php echo $auditorias->AuditoriaTipo->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaTipo" class="control-group auditorias_AuditoriaTipo">
<span<?php echo $auditorias->AuditoriaTipo->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaTipo->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaSucursal->Visible) { // AuditoriaSucursal ?>
		<td<?php echo $auditorias->AuditoriaSucursal->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaSucursal" class="control-group auditorias_AuditoriaSucursal">
<span<?php echo $auditorias->AuditoriaSucursal->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaSucursal->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaCreo->Visible) { // AuditoriaCreo ?>
		<td<?php echo $auditorias->AuditoriaCreo->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaCreo" class="control-group auditorias_AuditoriaCreo">
<span<?php echo $auditorias->AuditoriaCreo->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaCreo->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaResponsable->Visible) { // AuditoriaResponsable ?>
		<td<?php echo $auditorias->AuditoriaResponsable->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaResponsable" class="control-group auditorias_AuditoriaResponsable">
<span<?php echo $auditorias->AuditoriaResponsable->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaResponsable->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaVisita->Visible) { // AuditoriaFechaVisita ?>
		<td<?php echo $auditorias->AuditoriaFechaVisita->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaFechaVisita" class="control-group auditorias_AuditoriaFechaVisita">
<span<?php echo $auditorias->AuditoriaFechaVisita->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaFechaVisita->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaResultado->Visible) { // AuditoriaResultado ?>
		<td<?php echo $auditorias->AuditoriaResultado->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaResultado" class="control-group auditorias_AuditoriaResultado">
<span<?php echo $auditorias->AuditoriaResultado->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaResultado->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaObservacion->Visible) { // AuditoriaObservacion ?>
		<td<?php echo $auditorias->AuditoriaObservacion->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaObservacion" class="control-group auditorias_AuditoriaObservacion">
<span<?php echo $auditorias->AuditoriaObservacion->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaObservacion->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaPublicar->Visible) { // AuditoriaPublicar ?>
		<td<?php echo $auditorias->AuditoriaPublicar->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaPublicar" class="control-group auditorias_AuditoriaPublicar">
<span<?php echo $auditorias->AuditoriaPublicar->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaPublicar->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaEstado->Visible) { // AuditoriaEstado ?>
		<td<?php echo $auditorias->AuditoriaEstado->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaEstado" class="control-group auditorias_AuditoriaEstado">
<span<?php echo $auditorias->AuditoriaEstado->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaEstado->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaCierre->Visible) { // AuditoriaFechaCierre ?>
		<td<?php echo $auditorias->AuditoriaFechaCierre->CellAttributes() ?>>
<span id="el<?php echo $auditorias_delete->RowCnt ?>_auditorias_AuditoriaFechaCierre" class="control-group auditorias_AuditoriaFechaCierre">
<span<?php echo $auditorias->AuditoriaFechaCierre->ViewAttributes() ?>>
<?php echo $auditorias->AuditoriaFechaCierre->ListViewValue() ?></span>
</span>
</td>
<?php } ?>
	</tr>
<?php
	$auditorias_delete->Recordset->MoveNext();
}
$auditorias_delete->Recordset->Close();
?>
</tbody>
</table>
</div>
</td></tr></table>
<div class="btn-group ewButtonGroup">
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("DeleteBtn") ?></button>
</div>
</form>
<script type="text/javascript">
fauditoriasdelete.Init();
</script>
<?php
$auditorias_delete->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$auditorias_delete->Page_Terminate();
?>
